﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ClusHal
{
    class EuclideanDistance:IDistanceMeasure 
    {
        #region IDistanceMeasure Members

        public double Distance(Action a1, Action a2)
        {
            if (a1.Size == a2.Size)
            {
                double d = 0;
                for (int i = 0; i < a1.Size; i++)
                {
                    double t = a1[i] - a2[i];
                    d += t * t;
                }
                return Math.Sqrt(d);
            }
            else
                throw new Exception("Incorrect action sizes");
        }

        #endregion
    }
}
